#include "ShopWidget.h"

#include "ShopItemWidget.h"

#include <iostream>
#include <sstream>
#include <QtGui>

using namespace std;

void ShopWidget::initialize() {
    items[0] = new ShopItemWidget( this, shop->getItem(0),
                                   QString(":/Ressurection_logo.jpg") );
}

void ShopWidget::open() {
    if( isVisible() ) return;
    else {
        activateWindow();
        show();
        moneyCounter->show();
    }
}

void ShopWidget::updateLabel() {
    stringstream stream;
    stream << shop->getMoney() << " $                                                   ";
    moneyCounter->setText( (stream.str() ).c_str() );
}

void ShopWidget::keyPressEvent( QKeyEvent* event ) {
    switch( event->key() ) {
        case( SHOPKEY ): hide(); break;
        default:                 break;
    }
}
